package com.atguigu.gulimall.gulimallproduct.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @Author: Zjn ; Bring it on !!!
 * @Date: 2021/11/5 0005 7:53
 * Note:
 */
@Configuration
public class MyRedissonConfig {
    @Bean(destroyMethod="shutdown")
    public RedissonClient redisson() throws IOException {
        //1.创建配置
        Config config = new Config();
        //redis单节点模式
        config.useSingleServer().setAddress("redis://192.168.43.125:6379");
        return Redisson.create(config);
    }
}
